/*
 PureMVC Flex/CF Demo – File Uploader 
 Copyright (c) 2007 Simon Bailey <simon.bailey@puremvc.org>
 Your reuse is governed by the Creative Commons Attribution 3.0 License
 */
 
package com.cy.air.postXml
{
	import com.cy.air.postXml.controller.PostXmlCommand;
	import com.cy.air.postXml.controller.SetRequestUrlCommand;
	import com.cy.air.postXml.controller.StartupCommand;
	import com.cy.air.postXml.controller.UpdateRequestUrlCommand;
	
	import org.puremvc.as3.interfaces.IFacade;
	import org.puremvc.as3.patterns.facade.Facade;
	import org.puremvc.as3.patterns.observer.Notification;

	public class ApplicationFacade extends Facade implements IFacade
	{
		/**
		 * Notification name constants
		 */
		 public static const STARTUP:String= "startUp";
		 
		 public static const SEND_XML:String="sendXml"; 
		 
		 public static const CLEAR_RESPONSE:String="clear";
		 
		 
		 public static const UPDATE_RESPONSE_TEXT:String="updateResponseText";
		 
		 public static const UPDATE_REQUEST_URL:String="updateRequestUrl";
		 
		 public static const SET_REQUEST_URL:String="setRequestUrl";
		 
		 public static const REQUEST_URL_READY:String="requestUrlReady";
		 
		/**
		 * Singleton ApplicationFacade Factory Method
		 */
		public static function getInstance():ApplicationFacade
		{
			if ( instance == null ) instance = new ApplicationFacade();
			return instance as ApplicationFacade;
		}
		
		public function startup( app:HttpPostXML_UsePureMVCSQLite ):void
		{
			sendNotification( STARTUP, app );
		}
		
		override protected function initializeController():void
		{
			super.initializeController();
			
			registerCommand( STARTUP, StartupCommand );
			
			registerCommand(SEND_XML,PostXmlCommand);
			
			
			
			
			registerCommand(UPDATE_REQUEST_URL,UpdateRequestUrlCommand);
			
			registerCommand(SET_REQUEST_URL,SetRequestUrlCommand); 
			
		}
	}
}